package com.wandian.weather.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.amap.api.services.core.PoiItem;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wandian.weather.R;

public class MapSearchRecycleAdapter extends BaseQuickAdapter<PoiItem, BaseViewHolder> {

    private int selectItem=-1;
    public MapSearchRecycleAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, PoiItem item) { 

        //修改文字和字体
        TextView tv_address_name = helper.getView(R.id.tv_address_name);
        TextView tv_address_details =  helper.getView(R.id.tv_address_details);

        tv_address_name.setText(item.getTitle()+"");
        tv_address_details.setText(item.getSnippet()+"");
        ImageView iv_city_select = helper.getView(R.id.iv_select);
        iv_city_select.setVisibility(View.GONE);
        if(helper.getLayoutPosition()==selectItem)iv_city_select.setVisibility(View.VISIBLE);
    }
    public void notifySelectItemView(int item){
        this.selectItem = item;
        notifyDataSetChanged();
    }
}
